#include "stdafx.h"
#include "CppUnitTest.h"
#include <HSModel/BoundingBox.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace HSModelTests
  {
  TEST_CLASS(BoundingBoxTest)
    {
    public:

      TEST_METHOD(BoundingBoxTestBoundary)
        {
        Model3D model;
        Point3DID point1 = model.AddPoint(7.0, 2.0, 3.0);
        Point3DID point2 = model.AddPoint(1.0, 5.0, -6.0);
        Point3DID point3 = model.AddPoint(4.0, -8.0, 9.0);
        Point3DID point4 = model.AddPoint(11.0, 8.0, 9.0);
        BoundingBox b_box = CalculateBoundingBox(model);
        Assert::AreEqual(11.0, b_box.m_max_x);
        Assert::AreEqual(8.0, b_box.m_max_y);
        Assert::AreEqual(9.0, b_box.m_max_z);
        Assert::AreEqual(1.0, b_box.m_min_x);
        Assert::AreEqual(-8.0, b_box.m_min_y);
        Assert::AreEqual(-6.0, b_box.m_min_z);
        }
      
      TEST_METHOD(BoundingBoxTest_Empty)
        {
        Model3D model;
        BoundingBox b_box = CalculateBoundingBox(model);
        Assert::AreEqual(0.0, b_box.m_max_x);
        Assert::AreEqual(0.0, b_box.m_max_x);
        Assert::AreEqual(0.0, b_box.m_max_y);
        Assert::AreEqual(0.0, b_box.m_max_z);
        Assert::AreEqual(0.0, b_box.m_min_x);
        Assert::AreEqual(0.0, b_box.m_min_y);
        Assert::AreEqual(0.0, b_box.m_min_z);
        }
    };
  }